
function f审核删除成员(成员id){
    f移除onclick("shenhe_del");
    $.post("business/agent_manages.php",{'成员id':成员id,'参数':'审核删除成员'},function(data){
        if(data){
            alert('拒绝成功!');

        }else{
            alert('拒绝失败!');
        }
        location.replace(location.href='');
    });

}

function 审核成员(成员id){
    f移除onclick("shenhe");
    $.post('business/agent_manages.php',{'成员id':成员id,'参数':'审核成员'},function(data) {
        if(data){
            alert('审核用户成功');

            web发送通知(data);
        }else{
            alert('审核失败!');
        }
        location.replace(location.href='');
    });
}

function 删除群成员(成员id){

    f移除onclick("remove");
    $.post('business/agent_manages.php',{'成员id':成员id,'参数':'删除群成员'},function(data) {
        if(data){

            alert('删除用户成功!');
            web发送通知(data);
        }else{
            alert('删除失败!');
        }
        location.replace(location.href='');
    });
}

function 退出群(){
    f移除onclick("tuichuqun");
    var qun_user_id = $("#qun_user_id").val();
    $.post('business/agent_manages.php',{'成员id':qun_user_id,'参数':'退出群'},function(data) {
        if(data){
            alert('您成功退出该群');
            web发送通知(data);
            //location.replace(location.href='<?=$群聊列表?>');
            window.close();
        }else{
            alert('退出该群失败!');location.replace(location.href='');
        }
    });

}
function 设置成为群助手($成员id){
    f移除onclick("aideshezhi");
    $.post('business/agent_manages.php',{'成员id':$成员id,'参数':'设置成为群助手'},function(data) {
        if(data){
            alert('设置群助手成功!');

            location.replace(location.href='');
        }else{
            alert('设置群助手失败!');	location.replace(location.href='');
        }
    });

}
function 取消群助手($成员id){
    $.post('business/agent_manages.php',{'成员id':$成员id,'参数':'取消群助手'},function(data) {
        f移除onclick("aideclick");
        if(data){
            alert('取消群助手成功!');
            location.replace(location.href='');
        }else{
            alert('取消群助手失败!');
            location.replace(location.href='');
        }
    });

}

function f移除onclick(id){
    document.getElementById(id).onclick = function(){}
}


$(document).ready(function(){
    //create a new WebSocket object.
//		var wsUri = "ws://localhost:9090/linhe_hospital/server.php";
    var wsUri = "ws://<?= G_websocket接口.":".G_websocket端口."/".G_websocket地址?>/server.php";

    websocket = new WebSocket(wsUri);
    websocket.onopen = function(ev) { // connection is open

    }





});
function web发送通知(str){

    var mymessage = str; //get message text
    var userid = '0'; //get user id
    var headpic = ''; //get user 头像
    var 课程id = ""; //get 课程id
    var 群id = '<?= $群id?>'; //get 课程id
    var serverId="";
    //prepare json data
    var msg = {
        message: mymessage,
        userid: userid,
        headpic: headpic,
        课程id: 课程id,
        群id: 群id,
        serverId:serverId,
    };

    websocket.send(JSON.stringify(msg));
    location.replace(location.href='');
}

